package jwei.apps.indextank;

import jwei.apps.indextank.objects.Constants;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

    private Button name_search, street_search, tag_search, dish_search, ingredient_search, bookmarks;

    private Button settings;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        name_search = (Button) findViewById(R.id.name_search);
        street_search = (Button) findViewById(R.id.street_search);
        tag_search = (Button) findViewById(R.id.tags_search);
        dish_search = (Button) findViewById(R.id.dishes_search);
        ingredient_search = (Button) findViewById(R.id.ingredients_search);
        bookmarks = (Button) findViewById(R.id.bookmarks);
        settings = (Button) findViewById(R.id.settings);

        settings.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this, SettingsActivity.class));
            }

        });

        name_search.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent i = new Intent(MainActivity.this, SearchIndexActivity.class);
                i.putExtra("type", Constants.NAME_SEARCH);
                startActivity(i);
            }

        });

        street_search.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent i = new Intent(MainActivity.this, SearchIndexActivity.class);
                i.putExtra("type", Constants.STREET_SEARCH);
                startActivity(i);
            }

        });

        tag_search.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent i = new Intent(MainActivity.this, SearchIndexActivity.class);
                i.putExtra("type", Constants.TAGS_SEARCH);
                startActivity(i);
            }

        });

        dish_search.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent i = new Intent(MainActivity.this, SearchIndexActivity.class);
                i.putExtra("type", Constants.DISH_SEARCH);
                startActivity(i);
            }

        });

        ingredient_search.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent i = new Intent(MainActivity.this, SearchIndexActivity.class);
                i.putExtra("type", Constants.INGREDIENT_SEARCH);
                startActivity(i);
            }

        });

        bookmarks.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this, BookmarkActivity.class));
            }

        });
    }

}
